<?php

declare(strict_types=1);

/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */

use Hyperf\HttpServer\Router\Router;

/**
 * crm后台路由
 */
Router::addRoute(['GET','POST','PUT'],'/scan/pro', function () {
    return \Hyperf\ViewEngine\view('scan');
});


Router::addRoute(['GET','POST','PUT'],'/', function () {
    return 'success';
});
Router::addRoute(['GET','POST','PUT'],'', function () {
    return 'success';
});

use App\Controller\Admin\CheckTimeoutController;
Router::get('/api/check_out_device', [CheckTimeoutController::class, 'deviceTimeout']);
Router::get('/api/clear_log', [CheckTimeoutController::class, 'clearLogs']);

use App\Controller\Admin\ProSetController;
Router::get('/api/pro_set', [ProSetController::class, 'getParams']);
Router::get('/api/get_device_params', [ProSetController::class, 'getDeviceParams']);
Router::post('/api/update_params', [ProSetController::class, 'updateParams']);
Router::post('/api/start_port', [ProSetController::class, 'startPort']);
//后台dashboard
use App\Controller\Admin\StaticsController;

Router::addGroup('/api/dashboard', function () {
    Router::get('/get_back_image', [StaticsController::class, 'getBackImage']);
    Router::get('/scrollnum', [StaticsController::class, 'scrollNum']);
    Router::get('/get_chart', [StaticsController::class, 'chartData']);
    Router::get('/get_pie', [StaticsController::class, 'pieData']);
    Router::get('/month_data', [StaticsController::class, 'getMonth']);
});

//驾驶舱
//Router::addGroup('/api/deck', function () {
//    Router::get('/t_station_detail', [StaticsController::class, 'getStationDetail']);
//    Router::get('/t_station_list', [StaticsController::class, 'getNearDevice']);
//    Router::post('/today_statstics', [StaticsController::class, 'getTodayAreaData']);
//    Router::get('/user_chart', [StaticsController::class, 'userChart']);
//    Router::get('/all_statstics', [StaticsController::class, 'allStatstics']);
//    Router::get('/all_device', [StaticsController::class, 'allDevice']);
//    Router::get('/station_group', [StaticsController::class, 'StationGroup']);
//});



use App\Controller\Admin\AdminController;
//后台管理
Router::addGroup('/api/admin', function () {
    Router::post('/login', [AdminController::class, 'login']);
    Router::get('/info', [AdminController::class, 'getInfo'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::get('/logout', [AdminController::class, 'logout'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::get('/list', [AdminController::class, 'adminList'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::post('/create', [AdminController::class, 'create'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::post('/update', [AdminController::class, 'update'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::get('/delete', [AdminController::class, 'del'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
});




/**
 * 客服相关
 */
use App\Controller\Admin\NormalController;
Router::addGroup('/api/normal', function () {
    Router::get('/get', [NormalController::class, 'getNormal']);
    Router::get('/get_bank', [NormalController::class, 'getBank']);
    Router::post('/set_bank', [NormalController::class, 'setBank'],['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
    Router::post('/set', [NormalController::class, 'setNormal'],['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);
});

Router::get('/get_content', [App\Controller\NormalController::class, 'getContent']);
Router::post('/set_content', [App\Controller\NormalController::class, 'setContent']);


//上传相关
use App\Controller\UploadController;
Router::addGroup('/api/upload', function () {
    Router::post('/base_image', [UploadController::class, 'baseImg']);
    Router::post('/back_image', [UploadController::class, 'backImg']);
});

//经销商相关
use App\Controller\Admin\DistributorsController;
use App\Controller\Admin\ProfitController;
Router::get('/api/distributors/export_profit', [ProfitController::class, 'exportBill']);
Router::get('/api/distributors/all', [DistributorsController::class, 'all']);
Router::addGroup('/api/distributors', function () {
    Router::get('/get_profit', [ProfitController::class, 'getList']);
    Router::get('/get_banks', [DistributorsController::class, 'getBankInfo']);
    Router::get('/out_cash', [DistributorsController::class, 'outCash']);
    Router::get('/list', [DistributorsController::class, 'getList']);
    Router::get('/y_list', [\App\Controller\Admin\YDistributorsController::class, 'getList']);
    Router::get('/y_station_list', [\App\Controller\Admin\YDistributorsController::class, 'getStationList']);
    Router::get('/y_device_list', [\App\Controller\Admin\YDistributorsController::class, 'getDeviceList']);
    Router::get('/y_change_status', [\App\Controller\Admin\YDistributorsController::class, 'changeStatus']);
    Router::get('/getAll', [DistributorsController::class, 'getAll']);
    Router::post('/create', [DistributorsController::class, 'create']);
    Router::post('/change_pass', [DistributorsController::class, 'changePass']);
    Router::get('/change_status', [DistributorsController::class, 'changeStatus']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 后台用户管理
 */
use App\Controller\Admin\UsersController;
Router::addGroup('/api/user', function () {
    Router::get('/list', [UsersController::class, 'getList']);
    Router::post('/create', [UsersController::class, 'create']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 反馈建议处理
 */
use App\Controller\Admin\FeedbackController;
Router::addGroup('/api/feedback', function () {
    Router::get('/list', [FeedbackController::class, 'getList']);
    Router::get('/handle', [FeedbackController::class, 'handle']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 错误管理
 */
use App\Controller\Admin\DevicePortErrLogController;
Router::addGroup('/api/device_port_err_log', function () {
    Router::get('/getList', [DevicePortErrLogController::class, 'getList']);
    Router::post('/editStatus', [DevicePortErrLogController::class, 'editStatus']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 订单相关
 */
use App\Controller\Admin\OrderController;
Router::addGroup('/api/order', function () {
    Router::get('/balance_list', [OrderController::class, 'balanceList']);
    Router::get('/list', [OrderController::class, 'getList']);
    Router::get('/detail', [OrderController::class, 'getDetail']);
    Router::get('/export', [OrderController::class, 'exportOrder']);
    Router::get('/get_chart', [OrderController::class, 'getChart']);
    Router::get('/stop', [OrderController::class, 'stopOrder']);
    Router::get('/refund_service', [OrderController::class, 'refundService']);
    Router::get('/refund_normal', [OrderController::class, 'refundNormal']);
    Router::get('/refund_balance', [OrderController::class, 'refundBalance']);
    Router::get('/cancel_draw', [OrderController::class, 'cancelDraw']);
    Router::get('/refund_list', [OrderController::class, 'getRefundList']);
    Router::get('/refund_balance_list', [OrderController::class, 'balanceRefundList']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 财务相关
 */
use App\Controller\Admin\FinanceController;
Router::addGroup('/api/finance', function () {
    Router::get('/list', [FinanceController::class, 'getList']);
    Router::get('/export', [FinanceController::class, 'export']);
    Router::post('/create', [FinanceController::class, 'create']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 退款列表
 */
use App\Controller\Admin\RefundController;
Router::addGroup('/api/refund', function () {
    Router::get('/getList', [RefundController::class, 'getList']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

/**
 * 营销活动管理
 */
use App\Controller\Admin\CouponController;
Router::addGroup('/api/coupon', function () {
    Router::get('/record_list', [CouponController::class, 'getRecordList']);
    Router::get('/list', [CouponController::class, 'getList']);
    Router::post('/create', [CouponController::class, 'create']);
    Router::get('/handle', [CouponController::class, 'handle']);
    Router::get('/delete', [CouponController::class, 'del']);
    Router::get('/change_status', [CouponController::class, 'changeStatus']);
});


//充电套餐
use App\Controller\Admin\ChargeOptionController;

Router::addGroup('/api/charge_option', function () {
    Router::get('/list', [ChargeOptionController::class, 'getList']);
    Router::get('/all', [ChargeOptionController::class, 'getAll']);
    Router::post('/create', [ChargeOptionController::class, 'onceCreate']);
    Router::get('/del', [ChargeOptionController::class, 'del']);
    Router::get('/status', [ChargeOptionController::class, 'changeStatus']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);



//充电桩后台管理
use App\Controller\Admin\DevicesController;

Router::post('/api/device/batch_create', [DevicesController::class, 'batchCreate']);
Router::get('/api/device/qr_code', [DevicesController::class, 'qrCode']);
//Router::get('/api/device/signal_list', [DevicesController::class, 'getSignalList']);
//Router::get('/api/device/batch_power', [DevicesController::class, 'batchPower']);
Router::get('/api/device/show_charge', [DevicesController::class, 'getCharge']);
Router::addGroup('/api/device', function () {
    Router::get('/distributor_device', [DevicesController::class, 'distributorDevices']);
    Router::get('/list', [DevicesController::class, 'getList']);
    Router::post('/batch_change', [DevicesController::class, 'batchChange']);
    Router::get('/delete', [DevicesController::class, 'del']);
    Router::get('/detail', [DevicesController::class, 'detail']);
    Router::post('/create', [DevicesController::class, 'create']);
    Router::get('/change_status', [DevicesController::class, 'changeStatus']);
    Router::get('/unbind', [DevicesController::class, 'reset']);
    Router::get('/read_params', [DevicesController::class, 'readParams']);
    Router::post('/update_params', [DevicesController::class, 'updateParams']);
    Router::post('/start_port', [DevicesController::class, 'startPort']);
    Router::get('/restart', [DevicesController::class, 'restart']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

//电站管理
use App\Controller\Admin\StationController;

Router::addGroup('/api/station', function () {
    Router::get('/list', [StationController::class, 'getList']);
    Router::get('/moneyTotal', [StationController::class, 'moneyTotal']);
    Router::get('/exportTotal', [StationController::class, 'exportTotal']);
    Router::get('/orderTotal', [StationController::class, 'orderTotal']);
    Router::get('/powerTotal', [StationController::class, 'powerTotal']);
    Router::get('/select_charge', [StationController::class, 'selectCharge']);
    Router::get('/select_station', [StationController::class, 'selectStation']);
    Router::get('/class_station', [StationController::class, 'classStation']);
    Router::post('/create', [StationController::class, 'create']);
    Router::get('/change_status', [StationController::class, 'changeStatus']);
    Router::get('/del', [StationController::class, 'del']);
    Router::get('/get_distributor', [StationController::class, 'getDistributor']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

use App\Controller\Admin\StationClassController;

Router::addGroup('/api/class', function () {
    Router::get('/list', [StationClassController::class, 'getList']);
    Router::get('/getAllList', [StationClassController::class, 'getAllList']);
    Router::post('/create', [StationClassController::class, 'create']);
    Router::get('/del', [StationClassController::class, 'del']);
    Router::get('/stations', [StationClassController::class, 'stations']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

//广告位管理
use App\Controller\Admin\MainBannerController;

Router::addGroup('/api/banner', function () {
    Router::get('/list', [MainBannerController::class, 'getList']);
    Router::post('/create', [MainBannerController::class, 'create']);
    Router::get('/del', [MainBannerController::class, 'del']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

// 离线管理
use App\Controller\Admin\OfflineController;

Router::addGroup('/api/offline', function () {
    Router::get('/getList', [OfflineController::class, 'getList']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);

//服务保障管理
use App\Controller\Admin\ServiceController;
Router::addGroup('/api/service', function () {
    Router::get('/list', [ServiceController::class, 'getList']);
    Router::post('/create', [ServiceController::class, 'create']);
    Router::get('/del', [ServiceController::class, 'del']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAdminMiddleware::class]]);


//充电桩测试相关
use App\Controller\TestController;
Router::get('/test', [TestController::class, 'test']);
Router::get('/test1', [TestController::class, 'test1']);
Router::get('/system_restart', [TestController::class, 'system_restart']);
Router::get('/select_param', [TestController::class, 'selectParam']);
Router::get('/selectStatus', [TestController::class, 'selectStatus']);
Router::get('/device/bkv_test', [TestController::class, 'testBkv']);
Router::get('/device/end_order', [TestController::class, 'endOrder']);
/**
 * 前端商户端api
 */

//经销商相关
use \App\Controller\Home\Drp\LoginController as DrpLoginController;
Router::get('/drp/get_phone', [DrpLoginController::class, 'getPhoneNum']);
Router::addGroup('/drp', function () {
    Router::post('/login', [DrpLoginController::class, 'login']);
    Router::get('/statics', [DrpLoginController::class, 'statics'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);
    Router::get('/info', [DrpLoginController::class, 'getInfo'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);
    Router::get('/logout', [DrpLoginController::class, 'logout'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);
    Router::post('/editName', [DrpLoginController::class, 'editName'], ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);
});

//套餐相关
use App\Controller\Home\Drp\ChargeController;

Router::addGroup('/charge', function () {
    Router::get('/list', [ChargeController::class, 'getList']);
    Router::get('/all', [ChargeController::class, 'getAll']);
    Router::post('/create', [ChargeController::class, 'create']);
    Router::get('/delete', [ChargeController::class, 'del']);
    Router::get('/getChosed', [ChargeController::class, 'getChosed']);
    Router::post('/batchChose', [ChargeController::class, 'batchChose']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);

//经销商相关
use App\Controller\Home\Drp\DistributorsController as HomeDistributorsController;
Router::get('/distributors/get_bank', [HomeDistributorsController::class, 'getBank']);
Router::get('/distributors/export_bank', [HomeDistributorsController::class, 'exportBank']);
Router::get('/distributors/identify_img', [HomeDistributorsController::class, 'identifyImg']);
Router::addRoute(['GET','POST'],'/distributors/auto_cash_signtrue', [HomeDistributorsController::class, 'autoCash']);
Router::addRoute(['GET','POST','PUT'],'/distributors/cash_notify', [HomeDistributorsController::class, 'cashNotify']);
Router::addRoute(['GET','POST','PUT'],'/distributors/business_notify', [HomeDistributorsController::class, 'businessNotify']);
Router::post('/distributors/send_sms', [HomeDistributorsController::class, 'sendSms']);
Router::post('/distributors/create', [HomeDistributorsController::class, 'create']);
Router::get('/distributors/send_business', [HomeDistributorsController::class, 'sendBusiness']);
Router::post('/distributors/business', [HomeDistributorsController::class, 'makeBusinessNormal']);
Router::post('/distributors/business_detail', [HomeDistributorsController::class, 'makeBusinessDetail']);
Router::get('/distributors/query_business', [HomeDistributorsController::class, 'queryBusiness']);
Router::addGroup('/distributors', function () {
    Router::get('/create_business_account', [HomeDistributorsController::class, 'createBusinessAccount']);
    Router::get('/business_info', [HomeDistributorsController::class, 'getBusDetail']);//
    Router::get('/order_export', [HomeDistributorsController::class, 'orderExport']);//获取经销商
    Router::get('/month_bill', [HomeDistributorsController::class, 'getMonthBill']);//获取经销商
    Router::get('/bill_list', [HomeDistributorsController::class, 'getBillLog']);//获取经销商
    Router::get('/get_balance', [HomeDistributorsController::class, 'getBalance']);//获取经销商
    Router::get('/check_sms_code', [HomeDistributorsController::class, 'checkSmsCode']);//绑定账户信息
    Router::post('/bind_bank', [HomeDistributorsController::class, 'bindBank']);//绑定账户信息
    Router::get('/bank_info', [HomeDistributorsController::class, 'getBankInfo']);//获取账户信息
    Router::get('/del_bank', [HomeDistributorsController::class, 'delBankInfo']);//删除账户信息
    Router::get('/bank_balance', [HomeDistributorsController::class, 'bankBalance']);//查询余额
    Router::get('/account_transfer', [HomeDistributorsController::class, 'accountTransfer']);//创建余额支付
    Router::get('/out_cash', [HomeDistributorsController::class, 'outCash']);//创建
    Router::get('/cash_list', [HomeDistributorsController::class, 'cashLogList']);//创建
    Router::get('/list', [HomeDistributorsController::class, 'getList']);
    Router::post('/edit_warning', [HomeDistributorsController::class, 'editWarning']);
    Router::get('/warning_list', [HomeDistributorsController::class, 'getWarningList']);
    Router::post('/hf_upload', [HomeDistributorsController::class, 'setHfFile']);
    Router::post('/hf_upload_test', [HomeDistributorsController::class, 'setHfFileTest']);
    Router::post('/password', [HomeDistributorsController::class, 'password']);
},['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);

//设备相关
use \App\Controller\Home\Drp\HomeStationController;

Router::addGroup('/station',function(){
    Router::get('/class_create', [HomeStationController::class, 'createClass']);
    Router::get('/remove_class', [HomeStationController::class, 'removeClass']);
    Router::get('/batch_remove_class', [HomeStationController::class, 'BatchRemoveClass']);
    Router::get('/remove_station_class', [HomeStationController::class, 'removeStationClass']);
    Router::get('/set_class', [HomeStationController::class, 'setClass']);
    Router::get('/class_list', [HomeStationController::class, 'classList']);
    Router::get('/station_no_class', [HomeStationController::class, 'stationNoClass']);
    Router::get('/list', [HomeStationController::class, 'list']);
    Router::get('/getUnbind', [HomeStationController::class, 'getUnbind']);
    Router::get('/getAll', [HomeStationController::class, 'getAll']);
    Router::post('/create', [HomeStationController::class, 'create']);
    Router::get('/detail', [HomeStationController::class, 'detail']);
    Router::get('/del', [HomeStationController::class, 'del']);
    Router::get('/devices', [HomeStationController::class, 'devices']);
    Router::get('/chose_list', [HomeStationController::class, 'choseList']);
    Router::post('/batch_chose', [HomeStationController::class, 'batchChose']);
    Router::post('/bind_device', [HomeStationController::class, 'bindDevice']);
    Router::post('/unbind_device', [HomeStationController::class, 'unbindDevice']);
    Router::get('/change_charge', [HomeStationController::class, 'changeCharge']);
    Router::get('/change_refund', [HomeStationController::class, 'changeRefund']);
    Router::get('/stop_order', [HomeStationController::class, 'stopOrder']);
});

use \App\Controller\Home\Drp\HomeDeviceController;
Router::addGroup('/device', function () {
    Router::get('/balance_list', [HomeDeviceController::class, 'balanceList']);
    Router::get('/order_list', [HomeDeviceController::class, 'orderList']);
    Router::get('/statics', [HomeDeviceController::class, 'statics']);
    Router::get('/detail', [HomeDeviceController::class, 'detail']);
    Router::get('/list', [HomeDeviceController::class, 'list']);
    Router::get('/del', [HomeDeviceController::class, 'del']);
    Router::get('/edit', [HomeDeviceController::class, 'edit']);
    Router::post('/start_port', [HomeDeviceController::class, 'startPort']);
    Router::get('/params', [HomeDeviceController::class, 'normalParams']);
    Router::get('/read_params', [HomeDeviceController::class, 'readParams']);
    Router::post('/update_params', [HomeDeviceController::class, 'updateParams']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);

/**
 * 营销活动相关
 */

use \App\Controller\Home\Drp\HomeCouponController;
Router::get('/coupon/use_count', [HomeCouponController::class, 'getCouponCount']);
Router::addGroup('/coupon', function () {
    Router::post('/create', [HomeCouponController::class, 'create']);
    Router::get('/del', [HomeCouponController::class, 'del']);
    Router::get('/change_status', [HomeCouponController::class, 'changeStatus']);
    Router::get('/list', [HomeCouponController::class, 'list']);
    Router::get('/detail', [HomeCouponController::class, 'detail']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);

/**
 *经销商盈利
 */
use \App\Controller\Home\Drp\HomeProfitController;
Router::addGroup('/profit', function () {
    Router::get('/order_charts', [HomeProfitController::class, 'orderCharts']);
    Router::get('/order_profit', [HomeProfitController::class, 'orderProfit']);
    Router::get('/inside_profit', [HomeProfitController::class, 'insideProfit']);
    Router::get('/get_charts', [HomeProfitController::class, 'getCharts']);
    Router::get('/get_profit', [HomeProfitController::class, 'getProfit']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);

/**
 * 白名单
 */
use \App\Controller\Home\Drp\WhiteController;
Router::addGroup('/white', function () {
    Router::get('/check_list', [WhiteController::class, 'checkList']);
    Router::get('/check', [WhiteController::class, 'checkWhite']);
    Router::get('/white_list', [WhiteController::class, 'whiteList']);
    Router::get('/del_white', [WhiteController::class, 'delWhite']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTAuthDefaultSceneMiddleware::class]]);











/**
 * 前端用户端api
 */
use \App\Controller\Home\User\UserLoginController;
Router::addRoute(['GET','POST'],'/user/login', [UserLoginController::class, 'login']);
Router::get('/user/get_phone', [UserLoginController::class, 'getUserPhone'] );
Router::addGroup('/user', function () {
    Router::post('/bind_phone', [UserLoginController::class, 'bindPhone']);
    Router::get('/get_balance', [UserLoginController::class, 'getBalance']);
    Router::get('/info', [UserLoginController::class, 'getInfo']);
    Router::get('/check_service', [UserLoginController::class, 'checkService']);
    Router::get('/logout', [UserLoginController::class, 'logout']);
    Router::post('/save_info', [UserLoginController::class, 'saveInfo']);
    Router::get('/refresh_token', [UserLoginController::class, 'refreshToken']);
},  ['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
Router::get('/user/openSign', [UserLoginController::class, 'openSign']);


/**
 * 首页相关
 */
use \App\Controller\Home\User\MainController;
Router::addGroup('/main', function () {

    Router::get('/banner', [MainController::class, 'banner']);
    Router::post('/cooperation',[MainController::class,'cooperation']);
});
Router::get('/getArea', [MainController::class, 'getArea']);

/**
 * 用户操作设备相关
 */
use \App\Controller\Home\User\UserDeviceController;
Router::addRoute(['GET','POST','PUT'],'/qrcode_parse', [UserDeviceController::class, 'qrCodeParse']);
Router::addRoute(['GET','POST','PUT'],'/qrcode_distributor', [UserDeviceController::class, 'qrCodeDistributor']);
Router::get('/user/device/service_list', [UserDeviceController::class, 'serviceList']);
Router::addGroup('/user/device', function () {
    Router::get('/charge', [UserDeviceController::class, 'getCharge']);
    Router::get('/detail', [UserDeviceController::class, 'detail']);
    Router::get('/getNearDevice', [UserDeviceController::class, 'getNearDevice']);

    Router::get('/get_list', [UserDeviceController::class, 'getDeviceList']);
    Router::get('/get_service', [UserDeviceController::class, 'getService']);
});
Router::get('/api/device/charge', [UserDeviceController::class, 'getCharge']);

/**
 * 用户订单
 */
use \App\Controller\Home\User\UserOrderController;
Router::get('/user/order/refund_order', [UserOrderController::class, 'refundOrder']);
Router::get('/user/order/order_test', [UserOrderController::class, 'orderTest']);
Router::get('/user/order/create_test', [UserOrderController::class, 'createTest']);
Router::addGroup('/user/order', function () {
//    Router::addRoute(['GET','POST','PUT'],'/wx_refund', [UserOrderController::class, 'wxRefund']);
//    Router::addRoute(['GET','POST','PUT'],'/wx_refund_balance', [UserOrderController::class, 'wxRefundBalance']);
//    Router::addRoute(['GET','POST','PUT'],'/ali_notify', [UserOrderController::class, 'aliNotify']);
    Router::addRoute(['GET','POST','PUT'],'/balance_notify', [UserOrderController::class, 'balanceNotify']);
//    Router::addRoute(['GET','POST','PUT'],'/ali_balance_notify', [UserOrderController::class, 'aliBalanceNotify']);
//    Router::addRoute(['GET','POST','PUT'],'/do_refund', [UserOrderController::class, 'doRefund']);



    Router::addRoute(['GET','POST','PUT'],'/refund_normal', [UserOrderController::class, 'refundNormal']);
    Router::addRoute(['GET','POST','PUT'],'/refund_service', [UserOrderController::class, 'refundService']);
    Router::get('/check_status', [UserOrderController::class, 'checkOrderStatus']);
    Router::get('/check_balance', [UserOrderController::class, 'checkBalanceStatus']);
    Router::addRoute(['GET','POST','PUT'],'/wx_notify', [UserOrderController::class, 'wxNotify']);//目前用
    Router::addRoute(['GET','POST','PUT'],'/refund_notify', [UserOrderController::class, 'refundNotify']);//目前用;
    Router::addRoute(['GET','POST','PUT'],'/refund_balance_notify', [UserOrderController::class, 'refundBalanceNotify']);//目前用;
    Router::post('/create', [UserOrderController::class, 'createOrder']);
    Router::get('/stop', [UserOrderController::class, 'stopOrder']);
    Router::get('/fail', [UserOrderController::class, 'failOrder']);
    Router::get('/charge_order', [UserOrderController::class, 'getChargeOrder']);
    Router::get('/using_list', [UserOrderController::class, 'usingList'],['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
    Router::get('/list', [UserOrderController::class, 'myOrderList'],['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
    Router::get('/balance_list', [UserOrderController::class, 'balanceList'],['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
    Router::post('/create_balance', [UserOrderController::class, 'createBalance']);
    Router::post('/feedback', [UserOrderController::class, 'feedback'],['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
    Router::get('/feed_order', [UserOrderController::class, 'feedOrderList'],['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);
});

/**
 * 用户优惠券相关
 */
use \App\Controller\Home\User\UserCouponController;
Router::get('/user/coupon/money_coupon', [UserCouponController::class, 'getMoneyCoupon']);
Router::addGroup('/user/coupon', function () {
    Router::get('/receive', [UserCouponController::class, 'receive']);
    Router::get('/self_list', [UserCouponController::class, 'selfList']);
    Router::get('/add_white', [UserCouponController::class, 'addWhite']);
    Router::get('/check_white', [UserCouponController::class, 'checkWhite']);
}, ['middleware' => [Phper666\JWTAuth\Middleware\JWTUserMiddleware::class]]);

/**
 * 服务协议
 */
use \App\Controller\Home\User\UserServiceController;
Router::get('/user/service/get_list', [UserServiceController::class, 'getList']);


Router::get('/user/service/test_sdk', [UserServiceController::class, 'testSdk']);
Router::get('/user/service/test_refund', [UserServiceController::class, 'testRefund']);



use \App\Controller\DeviceController;
Router::post('/callback/start', [DeviceController::class, 'start']);
Router::post('/callback/end', [DeviceController::class, 'end']);

